bitkeeper revision 1.7.1.9 (3dff745dQXvY5lV_SsLHnw3PlaxUMw)
authorsmh22@boulderdash.cl.cam.ac.uk <smh22@boulderdash.cl.cam.ac.uk>
Tue, 17 Dec 2002 19:00:45 +0000 (19:00 +0000)
committersmh22@boulderdash.cl.cam.ac.uk <smh22@boulderdash.cl.cam.ac.uk>
Tue, 17 Dec 2002 19:00:45 +0000 (19:00 +0000)
robusify /proc/vfr parsing and xen Makefile tweak

xen-2.4.16/Makefile
xenolinux-2.4.16-sparse/arch/xeno/drivers/dom0/vfr.c

index 7ede454ee87bae4fd24b41b2b6cb2c3be99147f3..846c0e6f1214cf0f1d45378581b71f159c21bb69 100644 (file)
@@ -4,6 +4,7 @@ export BASEDIR := $(shell pwd)
 include Rules.mk
 
 default: $(TARGET)
+       gzip -f -9 < $(TARGET) > $(TARGET).gz
 
 install: $(TARGET)
        gzip -f -9 < $(TARGET) > $(TARGET).gz
index d6f6616262a49c26504c663b3b887e56d02aad81..13fe25ec9c8eb5dd73eeec1fe1fb1dfcf1064a98 100644 (file)
@@ -56,6 +56,9 @@ static int vfr_read_proc(char *page, char **start, off_t off,
  *
  */
 
+#define isspace(_x) ( ((_x)==' ')  || ((_x)=='\t') || ((_x)=='\v') || \
+                     ((_x)=='\f') || ((_x)=='\r') || ((_x)=='\n') )
+
 static int vfr_write_proc(struct file *file, const char *buffer,
                                            u_long count, void *data)
 {
@@ -70,12 +73,12 @@ static int vfr_write_proc(struct file *file, const char *buffer,
   memset(&op, 0, sizeof(network_op_t));
 
   // get the command:
-  while ( count && (buffer[ts] == ' ') ) { ts++; count--; } // skip spaces.
+  while ( count && isspace(buffer[ts]) ) { ts++; count--; } // skip spaces.
   te = ts;
-  while ( count && (buffer[te] != ' ') ) { te++; count--; } // command end
+  while ( count && !isspace(buffer[te]) ) { te++; count--; } // command end
   if ( te <= ts ) goto bad;
   tl = te - ts;
-
+  
   if ( strncmp(&buffer[ts], "ADD", tl) == 0 )
   {
      op.cmd = NETWORK_OP_ADDRULE;
@@ -119,18 +122,19 @@ static int vfr_write_proc(struct file *file, const char *buffer,
   while (count)
   {
     //get field
-    ts = te; while ( count && (buffer[ts] == ' ') ) { ts++; count--; }
+    ts = te; while ( count && isspace(buffer[ts]) ) { ts++; count--; }
     te = ts;
-    while ( count && (buffer[te] != ' ') && (buffer[te] != '=') ) 
+    while ( count && !isspace(buffer[te]) && (buffer[te] != '=') ) 
       { te++; count--; }
-    if ( te <= ts ) goto bad;
+    if ( te <= ts )
+       goto doneparsing;
     tl = te - ts;
     fs = ts; fe = te; fl = tl; // save the field markers.
     // skip "   =   " (ignores extra equals.)
-    while ( count && ((buffer[te] == ' ') || (buffer[te] == '=')) ) 
+    while ( count && (isspace(buffer[te]) || (buffer[te] == '=')) ) 
       { te++; count--; }
     ts = te;
-    while ( count && (buffer[te] != ' ') ) { te++; count--; }
+    while ( count && !isspace(buffer[te]) ) { te++; count--; }
     tl = te - ts;
 
     if ( (fl <= 0) || (tl <= 0) ) goto bad;
@@ -176,9 +180,9 @@ static int vfr_write_proc(struct file *file, const char *buffer,
       op.u.net_rule.dst_interface = anton(&buffer[ts], tl);
     }
     else if ( (strncmp(&buffer[fs], "proto", fl) == 0))
-    {
-      if (strncmp(&buffer[ts], "any", tl) == 0)
-          op.u.net_rule.proto = NETWORK_PROTO_ANY;
+    {  
+      if (strncmp(&buffer[ts], "any", tl) == 0) 
+         op.u.net_rule.proto = NETWORK_PROTO_ANY; 
       if (strncmp(&buffer[ts], "ip", tl) == 0)
          op.u.net_rule.proto = NETWORK_PROTO_IP;
       if (strncmp(&buffer[ts], "tcp", tl) == 0)